package legumes.client.services.callbacks;

import legumes.client.services.LegumesServicesHelper;
import legumes.client.services.util.rpc.SequencableRPCCall;
import legumes.shared.domain.Store;

public class AddStoreCallback extends SequencableRPCCall<Store> {

	private Store storeToAdd;
	private Store addedStore;

	public AddStoreCallback(Store customerToAdd_) {
		storeToAdd = customerToAdd_;
	}

	@Override
	protected void doCall() {
		LegumesServicesHelper.LEGUMES_SERVICES.addStore(storeToAdd, this);
	}

	@Override
	public void onSuccess(Store result_) {
		addedStore = result_;
		callNext();
	}

	public Store getAddedStore() {
		return addedStore;
	}

}
